package com.qf.listener;

import com.event.EventListener;
import com.qf.entity.Hotal;
import com.qf.service.ISearchService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class HotalEventListener implements EventListener<Hotal> {

    @Autowired
    private ISearchService searchService;

    @Override
    public String eventType() {
        return "hotal_insert";
    }

    @Override
    public void eventHandler(Hotal hotal) {
        System.out.println("搜索服务接收到酒店新增的事件消息：" + hotal);
        searchService.insertHotal(hotal);
    }
}
